package com.are;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;


public class SendLocation {

	private URL Url;


	public SendLocation(String url) {
		try {
			this.Url = new URL(url);
		} catch (MalformedURLException e) {
			throw new RuntimeException(e);
		}
	}

	public String Send() {
		String result = "";
		HttpURLConnection urlConnection = null;

		try {
			urlConnection = (HttpURLConnection) Url.openConnection();

			InputStream in = new BufferedInputStream(
					urlConnection.getInputStream());
			
			 BufferedReader reader = new BufferedReader(new InputStreamReader(in,"utf-8"));
	         StringBuilder sb = new StringBuilder();
	         String line = null;
	         while ((line = reader.readLine()) != null) {
	             sb.append(line);
	         }
	         in.close();
	         result=sb.toString();
	         System.out.println(result);

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();

		} finally {
			if (urlConnection != null) {
				urlConnection.disconnect();
			}
		}
		return result;
	}

}